home *** CD-ROM | disk | FTP | other *** search
- ; SCRSUBI - screen display subroutine for interpretive BASIC
- ; Copyright 1983 Data Base Decisions
- ; CALL SCRSUBI(LIN$,ROW%,COL%,COLR%)
- ; LIN$ is the line to be displayed - can be up to 255 characters
- ; ROW% is the row where LIN$ is to start (1-25)
- ; COL% is the column where LIN$ is to start (1-80)
- ; COLR% is the color attribute to be used (see appendix C of Tech Reference)
-
- skip equ 1 ; 1 for interpretive, 2 for compiled
-
- cseg segment para public 'code'
- public scrsubi
- scrsubi proc far
- assume cs:cseg,ds:nothing,ss:nothing,es:nothing
- push bp
- mov bp,sp
- push es
- mov si,[bp+10] ; get row
- mov ax,[si]
- dec ax ; down by 1
- mov cx,160
- mul cx ; multiply by 160
- mov si,[bp+8] ; get column
- mov bx,[si] ; in bx
- dec bx ; down by 1
- sal bx,1 ; multiply by 2
- add ax,bx ; got location
- mov di,ax
- mov ax,0 ; check monitor type
- mov es,ax
- mov ax,es:[410h] ; get config byte
- and al,30h ; isolate monitor type
- cmp al,30h ; color?
- jnz p010 ; yes
- mov ax,0b000h ; mono screen address
- jmp p020
- p010: mov ax,0b800h ; color screen address
-
- p020: mov dx,es:[463h] ; point to 6845 base port
- add dx,6 ; point to status port
-
- mov es,ax ; point to monitor
- mov si,[bp+6] ; get color attribute
- mov bh,[si] ; in bh
- mov si,[bp+12] ; point to lin$
- mov cl,[si] ; length in cl - up to 255
- mov ch,0
- jcxz p060 ; quit if string length is zero
- add si,skip ; addr of string
- mov si,[si]
- cld
-
- p030: mov bl,[si] ; get next character
-
- p040: in al,dx ; get crt status
- test al,1 ; is it low?
- jnz p040 ; no - wait
- cli ; no interrupts
-
- p050: in al,dx ; get crt status
- test al,1 ; is it high?
- jz p050 ; no - wait
-
- mov ax,bx ; move color & character
- stosw ; move color & character again
- sti ; interrupts back on
- inc si ; point to next character
- loop p030 ; done?
-
- p060: pop es ; restore es
- pop bp ; return to caller
- ret 8
-
- scrsubi endp
- cseg ends
- end
-